import {request} from '@/utils/request'
//base url
const BASE_URL = process.env.VUE_APP_API_BASE_URL
const api = {
    get_device_list: '/device/list_device', //查询设备的基本信息-
    delete_device: '/device/delete_device', //根据设备id删除设备信息-
    save_device: '/device/save_device', //新建设备信息-

    get_device_group_list: '/device/list_device_group', //设备组-
    delete_device_group: '/device/delete_device_group', //根据设备组id删除设备信息-
    save_device_group: '/device/save_device_group', //保存设备组信息-

    get_device_group_relation_list: '/device/list_device_group_relation',//查询设备设备组关联的基本信息-
    delete_device_group_relation: '/device/delete_device_group_relation', //根据id删除设备设备组关联信息-
    save_device_group_relation: '/device/save_device_group_relation', //保存设备设备组关联信息-

    get_device_parts_relation_list: '/device/list_device_parts_relation',//查询设备-备件关联的基本信息-
    delete_device_parts_relation: '/device/delete_device_parts_relation', //根据id删除设备-备件关联信息-
    save_device_parts_relation: '/device/save_device_parts_relation', //保存设备-备件关联信息-

    get_device_reform_info_list: '/device/list_device_reform_info',//查询设备的改造信息-
    save_device_reform_info: '/device/save_device_reform_info',//保存设备的改造信息-

    get_device_manage_info_list: '/device/list_device_manage_info',//查询设备的处置信息-
    save_device_manage_info: '/device/save_device_manage_info', //保存设备的处置信息-


    get_spare_parts_list: '/spare_parts/list_spare_parts', //查询备件的基本信息-
    delete_spare_parts: '/spare_parts/delete_spare_parts',//根据备件id删除设备信息-
    save_spare_parts: '/spare_parts/save_spare_parts',//新建备件信息-

    get_spare_parts_inventory_list: '/spare_parts/list_spare_parts_inventory',   //查询备件库存信息的基本信息-
    delete_spare_parts_inventory: '/spare_parts/delete_spare_parts_inventory', //根据备件库存信息id删除备件库存信息-
    save_spare_parts_inventory: '/spare_parts/save_spare_parts_inventory',//新建备件库存信息-


    get_spare_parts_request_list: '/spare_parts/list_spare_parts_request',  //查询备件申请单信息的基本信息-
    delete_spare_parts_request: '/spare_parts/delete_spare_parts_request',//根据备件申请单id删除备件申请单信息-
    save_spare_parts_request: '/spare_parts/save_spare_parts_request',//新建备件申请单信息-

    get_spare_parts_request_parts_relation_list: '/spare_parts/list_spare_parts_request_parts_relation', //查询备件申请单-备件关联的基本信息-
    delete_spare_parts_request_parts_relation: '/spare_parts/delete_spare_parts_request_parts_relation',//根据备件申请单-备件关联的id删除申请单-备件关联信息-
    save_spare_parts_request_parts_relation: '/spare_parts/save_spare_parts_request_parts_relation',//新建申请单-备件关联信息-

    get_supplier_by_id: '/cache/get_cache_by_id', //根据id查询供应商信息-

    get_device_type_list: '/base_information/list_device_type',//查询设备类型信息-

    get_device_grade_list: '/base_information/list_device_grade',//查询设备等级-

    get_device_maintenance_info_all:'/device_maintenance/list_device_maintenance_info_all',//获取所有设备保养信息

    get_userName_by_userId: '/cache/get_cache_by_id', //根据id查询用户name-

    get_device_inspection_all_list:'/device_inspection/list_device_inspection_all',//查所有点检记录

    get_device_repair_all_list:'/device_repair/list_device_repair_all',

    get_cache_by_vaguename:'/cache/get_cache_by_vaguename',//模糊查询生产厂家by name

    get_device_maintenance_project_list:'/base_information/list_device_maintenance_project',//保养项目list

    get_device_maintenance_type_project_relation_list:'/device_maintenance/list_device_maintenance_type_project_relation',//device_id关系list

    get_device_inspection_project_result_list: '/device_inspection/list_device_inspection_project_result',//关系表

    get_device_inspection_project_list:'/base_information/list_device_inspection_project',//点检项目list

    get_device_maintenance_type_list:'/base_information/list_device_maintenance_type',//保养类型list

    delete_device_maintenance_project:'/base_information/delete_device_maintenance_project',//删除保养项目

    save_device_maintenance_project:'/base_information/save_device_maintenance_project',

    save_device_maintenance_type:'/base_information/save_device_maintenance_type',

    save_device_maintenance_type_project_relation:'/device_maintenance/save_device_maintenance_type_project_relation',

    save_device_inspection_project:'/base_information/save_device_inspection_project',

    save_device_inspection_project_result:'/device_inspection/save_device_inspection_project_result',

    delete_device_maintenance_type:'/base_information/delete_device_maintenance_type',

    delete_device_maintenance_type_project_relation:'/device_maintenance/delete_device_maintenance_type_project_relation',

    save_device_inspection_project_relation:'/device_inspection/save_device_inspection_project_relation',

    get_device_inspection_project_relation_list:'/device_inspection/list_device_inspection_project_relation',

    get_group_grade_list:'/base_information/list_group_grade',

    file_upload:'/file/upload'

}

for (const apiKey in api) {
    api[apiKey] = BASE_URL + api[apiKey];
}

export function file_upload_url () {
    return api.file_upload
}
export function get_group_grade_list(parameter) {
    return request( api.get_group_grade_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )

}

export function get_device_inspection_project_relation_list(parameter) {
    return request( api.get_device_inspection_project_relation_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )

}

export function save_device_inspection_project_relation(parameter) {
    return request( api.save_device_inspection_project_relation,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}
export function delete_device_maintenance_type_project_relation(parameter) {
    return request( api.delete_device_maintenance_type_project_relation,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}

export function delete_device_maintenance_type(parameter) {
    return request( api.delete_device_maintenance_type,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}
// export function save_device_inspection_project_result(parameter) {
//     return request( api.save_device_inspection_project_result,
//         'post',
//         parameter,
//         // { headers: parameter.headers }
//     )
// }

export function save_device_inspection_project(parameter) {
    return request( api.save_device_inspection_project,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}

export function save_device_maintenance_type_project_relation(parameter) {
    return request( api.save_device_maintenance_type_project_relation,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}

export function save_device_maintenance_type(parameter) {
    return request( api.save_device_maintenance_type,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}
export function save_device_maintenance_project(parameter) {
    return request( api.save_device_maintenance_project,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}


export function delete_device_maintenance_project(parameter) {
    return request( api.delete_device_maintenance_project,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}


export function get_device_maintenance_type_list(parameter) {
    return request( api.get_device_maintenance_type_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )

}
export function get_device_inspection_project_list(parameter) {
    return request( api.get_device_inspection_project_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )

}
export function get_device_inspection_project_result_list(parameter) {
    return request( api.get_device_inspection_project_result_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )

}

export function get_device_maintenance_type_project_relation_list(parameter) {
    return request( api.get_device_maintenance_type_project_relation_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}


export function get_device_maintenance_project_list(parameter) {
    return request( api.get_device_maintenance_project_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function get_cache_by_vaguename(parameter) {
    return request( api.get_cache_by_vaguename,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function get_device_list(parameter) {
    return request( api.get_device_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function delete_device(parameter) {
    return request( api.delete_device,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}

export function save_device(parameter) {
    return request( api.save_device,
        'post',
        parameter,

    )
}

export function get_device_group_relation_list(parameter) {
    return request( api.get_device_group_relation_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function delete_device_group_relation(parameter) {
    return request( api.delete_device_group_relation,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}

export function save_device_group_relation(parameter) {
    return request( api.save_device_group_relation,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}

export function get_device_parts_relation_list(parameter) {
    return request( api.get_device_parts_relation_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function delete_device_parts_relation(parameter) {
    return request( api.delete_device_parts_relation,
        'post',
        parameter,
        { headers: parameter.headers },
        { 'Timestamp': parameter }
    )
}

export function save_device_parts_relation(parameter) {
    return request( api.save_device_parts_relation,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}

export function get_device_reform_info_list(parameter) {
    return request( api.get_device_reform_info_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function save_device_reform_info(parameter) {
    return request( api.save_device_reform_info,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}

export function get_device_manage_info_list(parameter) {
    return request( api.get_device_manage_info_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function save_device_manage_info(parameter) {
    return request( api.save_device_manage_info,
        'post',
        parameter,
        // { headers: parameter.headers }
    )
}





export function get_device_group_list(parameter) {
    return request( api.get_device_group_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function delete_device_group(parameter) {
    return request( api.delete_device_group,
        'post',
        parameter,
        // { headers: parameter.hearders }
    )
}

export function save_device_group(parameter) {
    return request( api.save_device_group,
        'post',
        parameter,
        // { headers: parameter.hearders }
    )
}



export function get_spare_parts_list(parameter) {
    return request( api.get_spare_parts_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function delete_spare_parts(parameter) {
    return request( api.delete_spare_parts,
        'post',
        parameter,
        // { headers: parameter.hearders }
    )
}

export function save_spare_parts(parameter) {
    return request( api.save_spare_parts,
        'post',
        parameter,
        // { headers: parameter.hearders }
    )
}

export function get_spare_parts_inventory_list(parameter) {
    return request( api.get_spare_parts_inventory_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function delete_spare_parts_inventory(parameter) {
    return request( api.delete_spare_parts_inventory,
        'post',
        parameter,
        // { headers: parameter.hearders }
    )
}

export function save_spare_parts_inventory(parameter) {
    return request( api.save_spare_parts_inventory,
        'post',
        parameter.data,
        // { headers: parameter.hearders }
    )
}

export function get_spare_parts_request_list(parameter) {
    return request( api.get_spare_parts_request_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function delete_spare_parts_request(parameter) {
    return request( api.delete_spare_parts_request,
        'post',
        parameter,
        // { headers: parameter.hearders }
    )
}

export function save_spare_parts_request(parameter) {
    return request( api.save_spare_parts_request,
        'post',
        parameter,
        // { headers: parameter.hearders }
    )
}

export function get_spare_parts_request_parts_relation_list(parameter) {
    return request( api.get_spare_parts_request_parts_relation_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function delete_spare_parts_request_parts_relation(parameter) {
    return request( api.delete_spare_parts_request_parts_relation,
        'post',
        parameter,
        // { headers: parameter.hearders }
    )
}

export function save_spare_parts_request_parts_relation(parameter) {
    return request( api.save_spare_parts_request_parts_relation,
        'post',
        parameter,
        // { headers: parameter.hearders }
    )
}

export function get_supplier_by_id(parameter) {
    return request( api.get_supplier_by_id,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}
export function get_device_type_list(parameter) {
    return request( api.get_device_type_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function get_device_grade_list(parameter) {
    return request( api.get_device_grade_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function get_device_maintenance_info_all(parameter) {
    return request( api.get_device_maintenance_info_all,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function get_userName_by_userId(parameter) {
    return request( api.get_userName_by_userId,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}
export function get_device_inspection_all_list(parameter) {
    return request( api.get_device_inspection_all_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}

export function get_device_repair_all_list(parameter) {
    return request( api.get_device_repair_all_list,
        'get',
        parameter,
        // { headers: parameter.headers }
    )
}